<style>
  body {
    margin: 0;
  }

  .header {
    width: 100%;
    height: 80px;
    line-height: 80px;
    background-color: pink;
    text-align: center;
    font-size: 30px;
    color: #fff;
  }
  .navbar {
    width: 100%;
    height: 60px;
    line-height: 60px;
    background-color: green;
    text-align: center;
    /* 兼容 */
    position: -webkit-sticky;
    position: -ms-sticky;
    position: -o-sticky;
    /* 粘性定位*/
    position: sticky;
    left: 0;
    top: 0;
    color: #fff;
  }
  .content {
    height: 140px;
    background: rgb(13, 68, 218);
    margin-top: 4px;
    text-align: center;
    line-height: 140px;
  }
</style>
<body>
  <div class="header">我是头部信息</div>
  <div class="navbar" id="navbar">我是导航栏</div>
  <div class="content">我是内容</div>
  <div class="content">我是内容</div>
  <div class="content">我是内容</div>
  <div class="content">我是内容</div>
  <div class="content">我是内容</div>
  <div class="content">我是内容</div>
  <div class="content">我是内容</div>
</body>
